java.lang.Object
ddejonge.bandana.gameBuilder.BandanaGameBuilder
public class BandanaGameBuilder
extends java.lang.Object
To create a Game object you can do one of the following:
- Call the static method BandanaGameBuilder.createDefaultGame(). This will return a default Game.
- Call the static method BandanaGameBuilder.createGame(String[] MDF, String[] SCO, String[] NOW) to generate a custom Game object. If you leave any of the three parameters null then it will use the default.
- Create an instance of BandanaGameBuilder and then call the methods setPhase(), setOwner() and placeUnit() as you like. After this, call buildGame() to obtain the Game object.
- Author:
- Dave de Jonge, Western Sydney University
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_MDF
static java.lang.String
DEFAULT_NON_SC_PROVINCES
static java.lang.String
DEFAULT_NOW
static java.lang.String
DEFAULT_POWERS
static java.lang.String
DEFAULT_REGIONS
static java.lang.String
DEFAULT_SCO
static java.lang.String
DEFAULT_SUP_CENTERS
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Power>
powers
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Province>
provinces
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Region>
regions
-
Constructor Summary
Constructors Constructor Description BandanaGameBuilder()
Creates a GameBuilder initialized with the standard map.BandanaGameBuilder(java.lang.String MDF)
Creates a GameBuilder initialized with a custom map.BandanaGameBuilder(java.lang.String[] MDF)
Creates a GameBuilder initialized with a custom map. -
Method Summary
Modifier and Type Method Description es.csic.iiia.fabregues.dip.board.Game
buildGame()
Builds the Game object based on the fields of this DiplomacyGameBuilder.static es.csic.iiia.fabregues.dip.board.Game
createDefaultGame()
Creates a game with default map and default distribution of units.static es.csic.iiia.fabregues.dip.board.Game
createEmptyGame(java.lang.String[] MDF)
Returns a Game object that represents an empty game.static es.csic.iiia.fabregues.dip.board.Game
createGame(java.lang.String[] MDF, java.lang.String[] SCO, java.lang.String[] NOW)
Creates a Game object defined by the three given arrays.void
placeUnit(java.lang.String powerName, java.lang.String regionName)
void
setOwner(java.lang.String powerName, java.lang.String supplyCenterName)
void
setPhase(es.csic.iiia.fabregues.dip.board.Phase phase, int year)
-
Field Details
-
DEFAULT_SCO
public static final java.lang.String DEFAULT_SCO- See Also:
- Constant Field Values
-
DEFAULT_NOW
public static final java.lang.String DEFAULT_NOW- See Also:
- Constant Field Values
-
DEFAULT_POWERS
public static final java.lang.String DEFAULT_POWERS- See Also:
- Constant Field Values
-
DEFAULT_SUP_CENTERS
public static final java.lang.String DEFAULT_SUP_CENTERS- See Also:
- Constant Field Values
-
DEFAULT_NON_SC_PROVINCES
public static final java.lang.String DEFAULT_NON_SC_PROVINCES- See Also:
- Constant Field Values
-
DEFAULT_REGIONS
public static final java.lang.String DEFAULT_REGIONS- See Also:
- Constant Field Values
-
DEFAULT_MDF
public static final java.lang.String DEFAULT_MDF- See Also:
- Constant Field Values
-
powers
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Power> powers -
provinces
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Province> provinces -
regions
protected java.util.Map<java.lang.String,es.csic.iiia.fabregues.dip.board.Region> regions
-
-
Constructor Details
-
BandanaGameBuilder
public BandanaGameBuilder()Creates a GameBuilder initialized with the standard map. -
BandanaGameBuilder
public BandanaGameBuilder(java.lang.String MDF)Creates a GameBuilder initialized with a custom map.- Parameters:
MDF
- A String representing the map, formated according to the DAIDE syntax.
-
BandanaGameBuilder
public BandanaGameBuilder(java.lang.String[] MDF)Creates a GameBuilder initialized with a custom map.- Parameters:
MDF
- An array of Strings representing the map, formated according to the DAIDE syntax.
-
-
Method Details
-
createDefaultGame
public static es.csic.iiia.fabregues.dip.board.Game createDefaultGame()Creates a game with default map and default distribution of units.- Returns:
-
createEmptyGame
public static es.csic.iiia.fabregues.dip.board.Game createEmptyGame(java.lang.String[] MDF)Returns a Game object that represents an empty game. That is: a game with no units and none of the supply centers is owned by anyone.- Parameters:
MDF
-- Returns:
-
createGame
public static es.csic.iiia.fabregues.dip.board.Game createGame(java.lang.String[] MDF, java.lang.String[] SCO, java.lang.String[] NOW)Creates a Game object defined by the three given arrays.- Parameters:
MDF
- Definition of the map (if null, the default map will be used).SCO
- Ownership of Supply Centers (if null, the initial supply center owners in the default game will be used).NOW
- Positions of the units (if null, the initial positions of the units in the default game will be used).- Returns:
-
setPhase
public void setPhase(es.csic.iiia.fabregues.dip.board.Phase phase, int year) -
placeUnit
public void placeUnit(java.lang.String powerName, java.lang.String regionName) -
setOwner
public void setOwner(java.lang.String powerName, java.lang.String supplyCenterName) -
buildGame
public es.csic.iiia.fabregues.dip.board.Game buildGame()Builds the Game object based on the fields of this DiplomacyGameBuilder.- Returns:
-